﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace System
{
    public static class EnumExt
    {
        public static bool IsTheSameKey(this Enum value, object otherKey)
        {
            string key = "";
            if (otherKey != null && otherKey.GetType().IsEnum)
            {
                key = otherKey.GetType().FullName;
                key = key.Replace("+", ".").XReplace("_Group\\.", ".") + ".";
            }
            key += otherKey.AsString();
            string enumKey = "";
            enumKey = value.GetType().FullName;
            enumKey = enumKey.Replace("+", ".").XReplace("_Group\\.", ".") + ".";
            enumKey += value.AsString();

            return key == enumKey;
        }
    }
}
